package com.ctsh.centersh.guideview

import android.support.v7.app.AppCompatActivity
import android.os.Bundle
import android.support.v4.content.ContextCompat
import android.view.View
import com.ctsh.centersh.guideview2.GuideMaskView
import kotlinx.android.synthetic.main.activity_main.*

class MainActivity : AppCompatActivity() {
    private var guideMaskView: GuideMaskView? = null

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)
        initGuideView01()
    }

    private fun initGuideView01() {
        guideMaskView = GuideMaskView(this@MainActivity)
            .setTargetView(tvTargetOne)//设置目标
            .setCustomGuideView(R.drawable.thanks_fee)
            .setgGuideWidthHeight(238F, 46F) //引导提示图片的宽高
            .setDirection(GuideMaskView.Direction.RIGHT_BOTTOM)
            .setShape(GuideMaskView.MyShape.RECTANGULAR) //高亮区域矩形
            .setRadius(1)
        guideMaskView?.setOnclickListener(object : GuideMaskView.OnClickCallback {
            override fun onClickedGuideView(v: View) {
                guideMaskView?.hide()
                initGuideView02()
            }
        })?.setTargetclickListener(View.OnClickListener { guideMaskView?.hide() })
            ?.show()

    }

    private fun initGuideView02() {
        guideMaskView = GuideMaskView(this@MainActivity)
            .setTargetView(tvTargetTwo)//设置目标
            .setCustomGuideView(R.drawable.thanks_fee)
            .setDirection(GuideMaskView.Direction.BOTTOM)
            .setShape(GuideMaskView.MyShape.RECTANGULAR) //高亮区域矩形
            .setgGuideWidthHeight(238F, 46F)
            .setRadius(48)
            .setBgColor(ContextCompat.getColor(this@MainActivity, R.color.color_b30da012))
        guideMaskView?.setOnclickListener(object : GuideMaskView.OnClickCallback {
            override fun onClickedGuideView(v: View) {
                guideMaskView?.hide()
            }
        })
            ?.setTargetclickListener(View.OnClickListener { guideMaskView?.hide() })
            ?.show()
    }

}
